<template>
    <transition name="dialog">
        <div class="e-dialog" v-if="visible">
            <div class="e-layer"></div>
            <div class="e-dialog-region">
                <slot></slot>
            </div>
        </div>
    </transition>
</template>

<script>
export default {
    name: 'EDialog',
    props: {
        visible: {
            type: Boolean,
            default: false
        }
    }
}
</script>

<style lang="scss" scoped>
.e-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    .e-layer {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, .6);
    }
    .e-dialog-region {
        position: absolute;
        top: 50%;
        left: 50%;
        min-width: 200px;
        min-height: 150px;
        background: #fff;
        transform: translate3d(-50%, -50%, 0);
        border-radius: 3px;
    }
}

.dialog-enter-active,
.dialog-leave-active {
    transition: all .2s ease
}

.dialog-enter,
.dialog-leave-to {
    opacity: 0;
    transform: translateY(-10px);
}
</style>

